<?php 
header("Content-Type: text/html; charset=UTF-8");
session_start();
$files_path="../uploadfile/";
$temp=@$_POST['temp'];



/*********************************/
//$UploadFile_name=$_POST['path'];//$_FILES['path']["name"];
$UploadFile_name=$_FILES['UploadFile']["name"];
$UploadFile=$_FILES['UploadFile']['tmp_name'];
/****************************************/

for($connt=0; $connt<10; $connt++)  //生成随机数字
{
	@$str .= rand(1,9);
}
//echo $UploadFile_name;
$post=strrpos($UploadFile_name,'.');
$length=strlen($UploadFile_name);
$file_ext=substr($UploadFile_name,$post,$length);
$file_alias = $str.$file_ext;
$fileLink = $file_alias;
//echo $file_alias;

$sign = DIRECTORY_SEPARATOR;
$path = "..".$sign."uploadfile".$sign.$file_alias;
$path ="../uploadfile/".$file_alias;
$pathRM ="../uploadfile/temp/rm".$file_alias;
//$path =$file_alias;
//echo $path;

$fileROOT="http://cfh.cfh.com:52";//$_SERVER['DOCUMENT_ROOT'];
$fileROOT=$fileROOT."/eshop/uploadfile/".$file_alias;
$fileROOTRM=$fileROOT."/eshop/uploadfile/temp/rm".$file_alias;



if(copy($UploadFile,$path)){
	include 'resizeimage.php';
	ResizeImage($path, $pathRM, $new_size=array('width'=>165,'height'=>136), $quantity="80",$method="gd2");
	//echo "fsdfs";
  ?>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
	location.href="uploadAds.php?file_alias=<?php echo $file_alias?>";
	//-->
	</SCRIPT>
<?php 
}else{
  ?>
	<SCRIPT LANGUAGE="JavaScript">
	<!--
	alert("Uploading files are incorrect, please upload again！");
	location.href="uploadAds.php";
	//-->
	</SCRIPT>
<?php
}?>
